package ${dir}.service.impl;


import java.util.List;
import ${dir}.service.${table.name!}Service;
import ${dir}.dao.${table.name!}Dao;
import ${dir}.entity.${table.name!};
import java.io.Serializable;
import java.sql.SQLException;
public class ${table.name!}ServiceImpl implements ${table.name!}Service {

	${table.name!}Dao ${table.lowcasename}Dao;
	
	@Override
	public boolean save${table.name!}(${table.name!} obj) {
		if(${table.lowcasename}Dao.add(obj)>0){
			return true;
		}
		return false;
	}
	
	public boolean edit${table.name!}(${table.name!} obj) {
		if(${table.lowcasename}Dao.update(obj)>0){
			return true;
		}
		return false;
	}
	
	public boolean delete${table.name!}(Serializable id) {
		if(${table.lowcasename}Dao.delete(id)>0){
			return true;
		}
		return false;
	}

	@Override
	public ${table.name!} get${table.name!}(Serializable id) {
		try {
			return ${table.lowcasename}Dao.selectOne(id);
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}

	@Override
	public List<${table.name!}> getAll() {
		try {
			return ${table.lowcasename}Dao.selectAll();
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}
}
